//
//  UIImage+ZMExtension.swift
//  OnlineClassRoom
//
//  Created by 智蚂优服 on 2020/5/12.
//  Copyright © 2020 智蚂优服. All rights reserved.
//

import Foundation
import UIKit
extension UIImage : ZMCompatible{}

extension ZM where Base : UIImage {
    public static func imageWithColor(color: UIColor) -> UIImage {
        let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
        UIGraphicsBeginImageContextWithOptions(rect.size, false, 0)
        let context = UIGraphicsGetCurrentContext()
        context!.setFillColor(color.cgColor)
        context!.fill(rect)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image!
    }
}
